//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.ysy.tz.core.engine;

import com.google.common.eventbus.EventBus;
import com.ysy.tz.core.selfcomp.MainPage;
import java.util.ResourceBundle;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javafx.application.Platform;
import javafx.geometry.Rectangle2D;
import javafx.scene.control.Dialog;
import javafx.stage.Screen;
import javafx.stage.Stage;
import org.apache.ibatis.session.SqlSessionFactory;

public class ApplicationContext {
    public static Stage mainStage;
    public static MainPage mainPage;
    public static SqlSessionFactory sqlSessionFactory;
    public static Dialog loginDialog;
    public static String machineCode;
    public static Integer enterpriseId;
    public static String enterpriseCode;
    public static boolean onlyShowGrading = false;
    public static EventBus eventBus = new EventBus();
    public static ResourceBundle commonBundle;
    public static final ExecutorService executor;

    public ApplicationContext() {
    }

    public static Rectangle2D getScreenBounds() {
        return Screen.getPrimary().getBounds();
    }

    public static Rectangle2D getScreenVisualBounds() {
        return Screen.getPrimary().getVisualBounds();
    }

    public static void postEvent(final Object obj) {
        Platform.runLater(new Runnable() {
            public void run() {
                ApplicationContext.eventBus.post(obj);
            }
        });
    }

    public static void showLoadingPane() {
        mainPage.getMaskerPane().setVisible(true);
    }

    public static void hideLoadingPane() {
        mainPage.getMaskerPane().setVisible(false);
    }

    static {
        executor = new ThreadPoolExecutor(2, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue());
    }
}
